<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        /* await会阻塞函数的执行，
        会优先执行await后面同步的代码，
        异步代码等待同步代码执行完毕后再去执行 */
        async function a1(){
            console.log("a1");
            await a2();
            console.log("end");
        }
        async function a2(){
            console.log("a2");
        }
        a1();
        console.log("a3");
        Promise.resolve().then(()=>
            {console.log("a4");}
        )
    </script>
</body>
</html>